from django.contrib import admin
from django.contrib.auth.admin import UserAdmin

from apps.accounts.models import User, ExternalSystemAPIWhiteList


@admin.register(User)
class UserAdmin(UserAdmin):
    list_display = ('username', 'name', 'email', 'is_active', 'is_superuser')

    fieldsets = (
        (None, {'fields': ('username', 'password')}),
        (('Personal Info'), {'fields': ('name', 'email')}),
        (('Permissions'),
         {'fields': ('is_active', 'is_staff', 'is_superuser', 'roles')})
    )

    add_fieldsets = ((None, {
        'classes': ('wide',),
        'fields': ('username', 'name', 'password1', 'password2', 'email', 'is_active', 'is_staff'), }),)


@admin.register(ExternalSystemAPIWhiteList)
class ExternalSystemAPIWhiteListAdmin(admin.ModelAdmin):
    list_display = ('user', 'api_method', 'api_address', 'api_description')
